package com.gesis.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * GesSubClassification entity. 
 * @author Juan Pablo Pazmin
 */
@Entity
@Table(name = "ges_sub_classification")
public class GesSubClassification implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Long subIdTopic;
	private GesClassification gesClassification;
	private Long subIdSubclassification;
	private String subDescClassification;
	private Set<GesTopic> gesTopics = new HashSet<GesTopic>(0);

	// Constructors

	/** default constructor */
	public GesSubClassification() {
	}

	/** minimal constructor */
	public GesSubClassification(Long subIdTopic,
			GesClassification gesClassification, Long subIdSubclassification,
			String subDescClassification) {
		this.subIdTopic = subIdTopic;
		this.gesClassification = gesClassification;
		this.subIdSubclassification = subIdSubclassification;
		this.subDescClassification = subDescClassification;
	}

	/** full constructor */
	public GesSubClassification(Long subIdTopic,
			GesClassification gesClassification, Long subIdSubclassification,
			String subDescClassification, Set<GesTopic> gesTopics) {
		this.subIdTopic = subIdTopic;
		this.gesClassification = gesClassification;
		this.subIdSubclassification = subIdSubclassification;
		this.subDescClassification = subDescClassification;
		this.gesTopics = gesTopics;
	}

	// Property accessors
	@Id
	@Column(name = "sub_id_topic", unique = true, nullable = false)
	public Long getSubIdTopic() {
		return this.subIdTopic;
	}

	public void setSubIdTopic(Long subIdTopic) {
		this.subIdTopic = subIdTopic;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "sub_id_classification", nullable = false)
	public GesClassification getGesClassification() {
		return this.gesClassification;
	}

	public void setGesClassification(GesClassification gesClassification) {
		this.gesClassification = gesClassification;
	}

	@Column(name = "sub_id_subclassification", nullable = false)
	public Long getSubIdSubclassification() {
		return this.subIdSubclassification;
	}

	public void setSubIdSubclassification(Long subIdSubclassification) {
		this.subIdSubclassification = subIdSubclassification;
	}

	@Column(name = "sub_desc_classification", nullable = false)
	public String getSubDescClassification() {
		return this.subDescClassification;
	}

	public void setSubDescClassification(String subDescClassification) {
		this.subDescClassification = subDescClassification;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "gesSubClassification")
	public Set<GesTopic> getGesTopics() {
		return this.gesTopics;
	}

	public void setGesTopics(Set<GesTopic> gesTopics) {
		this.gesTopics = gesTopics;
	}

}